classdef TrustRegion
    properties 
        rmin = 0.75;
        rgood = 0.8;
        Sc=  2;
    end
    methods
        function Rk1 = UpdateTrustRaduis(obj, Rk, E, Ek, Ce, Step, Grad,H)            
            Rk1 = Rk;            
            r = (E-Ek)/Ce;
            if r <= obj.rmin || r >=(2-obj.rmin)
                Rk1  = Rk/obj.Sc;
            end
            QNS = QuasiNewtenStep;
            Step1  = QNS.CalculateQuasiNewtenHessianStepVector(Grad, H);            
            nrm = norm(Step - Step1);
            if r>= obj.rgood && r <= (2-obj.rgood) && nrm > 10^-10
                Rk1 = Rk*(obj.Sc)^(0.5);
            end
        end
    end
end
